// 获取页面尺寸
function getPageSize() {
    var width = window.innerWidth || document.documentElement.clientWidth || document.body.clientWidth;
    var height = window.innerHeight || document.documentElement.clientHeight || document.body.clientHeight;
    return { width: width, height: height };
}

// 显示页面尺寸信息
export function showPageSize() {
    var {width, height} = getPageSize();
    console.log(`width:${width}px,height:${height}`);
}

// 初次加载时显示页面尺寸
window.onload = function() {
    showPageSize();
};

// 当窗口大小改变时重新显示页面尺寸
window.onresize = function() {
    showPageSize();
};